package com.qianchang.microfinance.view.hsmywallet;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.dm.library.http.DMOKHttpUtils;
import com.dm.library.http.HttpParams;
import com.dm.library.http.base.JsonResult;
import com.dm.library.http.callback.RequestCallBack;
import com.dm.library.utils.FormatUtil;
import com.dm.library.utils.ToastUtil;
import com.dm.library.widgets.element.DTextView;
import com.qianchang.microfinance.R;
import com.qianchang.microfinance.bean.BankCardBean;
import com.qianchang.microfinance.bean.FindUserBasicInfoBean;
import com.qianchang.microfinance.bean.MineUserInfo;
import com.qianchang.microfinance.global.ConstantAppInfo;
import com.qianchang.microfinance.utils.DMConstant;
import com.qianchang.microfinance.view.base.BaseFragment;
import com.qianchang.microfinance.view.dialog.alert.DimengSingleButtonAlertDialog;
import com.qianchang.microfinance.view.home.HomeFragment;
import com.qianchang.microfinance.view.mine.RechargeActivity;
import com.qianchang.microfinance.view.mine.TradRecordActivity;
import com.qianchang.microfinance.view.mine.WithDrawActivity;

/**
 * 鸿胜科技新增我的金币
 *
 */

public class HSMyoldFragment extends BaseFragment implements View.OnClickListener{

    DTextView tvMyMoney;
    private Button butRecharge;
    private Button withdraw;

    private FindUserBasicInfoBean findUserBasicInfoBean = new FindUserBasicInfoBean();
    private BankCardBean bankCardBean;
    private MineUserInfo mineUserInfo;



    @Override
    protected View onRootViewCreate(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.fragment_my_gold, container, false);
        tvMyMoney = (DTextView)view.findViewById(R.id.tv_my_money);
        tvMyMoney.setOnClickListener(HSMyoldFragment.this);
        butRecharge = (Button) view.findViewById(R.id.btn_recharge);
        butRecharge.setOnClickListener(this);
        return view;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle bundle = getArguments();
        if (bundle != null) {
            mineUserInfo = (MineUserInfo) bundle.getSerializable(MineUserInfo.class.getName());
            findUserBasicInfoBean = (FindUserBasicInfoBean) bundle.getSerializable(ConstantAppInfo.BASIC_INFO_BEAN);
            if (findUserBasicInfoBean == null) findUserBasicInfoBean = new FindUserBasicInfoBean();
            //改成用接口请求
            if (mineUserInfo != null) {
                tvMyMoney.setText(FormatUtil.numKbPointFormat(mineUserInfo.getAvailable()) + "");
            }
        }
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }

    @Override
    public void onResume() {
        super.onResume();

    }


    @Override
    public void onDetach() {
        super.onDetach();
    }

    @Override
    public void onClick(View view) {

        ///测试使用
        if(view.getId() == R.id.btn_recharge){
            startActivity(HSRecharCentreActivity.class);
            return;
        }
    }



}
